package com.yh.action;

import com.yh.entity.User;
import com.yh.services.IUserService;
import com.yh.services.impl.UserServiceImpl;
import com.yh.util.BaseAction;
import lombok.Data;

import static com.opensymphony.xwork2.Action.SUCCESS;

@Data
public class UserAction extends BaseAction {
    private String name;
    private String pwd;

    public String execute(){
        IUserService userService= new UserServiceImpl();
       User user=userService.login(new User(name,pwd));
       if (user!=null){
           getMapSession().put("user",user);
           return SUCCESS;
       }else{
           return "fail";
       }
    }

}
